program q1123;
var
    n, sum, i, ave, ans, k: longint;
    a: array[1..100] of longint;
begin
    assign(input, '');
    assign(output, '');
    reset(input);
    rewrite(output);

    readln(n);
    sum := 0;
    for i:=1 to n do begin
        read(a[i]);
        sum := sum + a[i];
    end;

    ave := sum div n;

    for i:=1 to n do
        a[i] := a[i] - ave;

    ans := 0;
    for i:=1 to n-1 do begin
        if (a[i] <> 0) then begin
            a[i+1] := a[i+1] + a[i];
            inc(ans);
        end;
    end;
   
    writeln(ans);

    close(input);
    close(output);
end.
